package object;

public class EqualsDemo {
    public static void main(String[] args) {
        String s1 = new String("hello");
        String s2 = new String("hello");
        System.out.println(s1.equals(s2));

        StringBuilder builder1 = new StringBuilder("hello");
        StringBuilder builder2 = new StringBuilder("hello");
        //StringBuilder类没有重写equals()，因此调用的还是Object类的equals()比较地址
        System.out.println(builder1.equals(builder2));

        //s1与builder1的类型不同，所以equals()一定是false
        System.out.println(s1.equals(builder1));


    }
}
